package org.linuxsogood.boot.nio;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

/**
 * @author liu.hongwei
 */
public class SocketChannelTest {

    public static void main(String[] args) throws IOException {
        // 使用 ServerSocketChannel SocketChannel网络
        ServerSocketChannel socketChannel = ServerSocketChannel.open();
        //
        SocketAddress address = new InetSocketAddress(7000);

        // 绑定端口到socket, 并启动
        socketChannel.socket().bind(address);

        // 创建buffer数组
        ByteBuffer[] byteBuffer = new ByteBuffer[2];
        byteBuffer[0] = ByteBuffer.allocate(5);
        byteBuffer[1] = ByteBuffer.allocate(3);

        SocketChannel socket = socketChannel.accept();


    }
}
